'use strict';
angular.module('app').controller('registerCtrl',['$interval','$http','$scope',function($interval,$http,$scope){
	$scope.user={};
	  $scope.submit = function(){
	  	// console.log($scope.user);
	  }
	 
	  $scope.send = function(){
	  	$http.get('data/code.json').then(function onSuccess(resp){
	  		if(resp.data.state===1){
	  			 var count = 60;
	  			$scope.time='60s';
	  			var interval = $interval(function(){
	  				if(count<=0){
	  					$interval.cancel(interval);
	  					$scope.time ='';
	  					return;
	  				}
	  				count--;
	  				$scope.time = count+'s';
	  			},1000);
	  		}
	  	})
	  }
}]);